Spot-On
spot-on-common.h
1 /*
2 ** Copyright (c) 2011 - 10^10^10, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Spot-On without specific prior written permission.
15 **
16 ** SPOT-ON IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** SPOT-ON, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef _spoton_common_h_
29 #define _spoton_common_h_
30 
31 #include <QHash>
32 #include <QStringList>
33 
34 #include <limits>
35 
36 #define SPOTON_VERSION_STR "2019.04.04"
37 
38 typedef QHash<QString, QByteArray> QStringByteArrayHash;
39 typedef QList<QByteArray> QByteArrayList;
40 typedef QList<QPair<QByteArray, qint64> > QPairByteArrayInt64List;
41 typedef QPair<QByteArray, QByteArray> QPairByteArrayByteArray;
42 
44 {
45  public:
46  static QList<int> LANE_WIDTHS;
47  static QString SSL_CONTROL_STRING;
48  static QStringList ACCEPTABLE_URL_SCHEMES;
49  static QStringList SPOTON_ENCRYPTION_KEY_NAMES;
50  static QStringList SPOTON_SIGNATURE_KEY_NAMES;
51  static const int ACCOUNTS_RANDOM_BUFFER_SIZE = 64;
52  static const int BUZZ_MAXIMUM_ID_LENGTH = 256; /*
53  ** Please use a number
54  ** that's divisible by two.
55  ** The number of random bytes
56  ** to be used is half of this
57  ** number. The actual ID
58  ** will be represented in
59  ** base sixteen.
60  */
61  static const int BUZZ_TIME_DELTA = 30;
62  static const int CACHE_TIME_DELTA_MAXIMUM_STATIC = 30;
63  static const int CHAT_MAXIMUM_REPLAY_QUEUE_SIZE = 15;
64  static const int CHAT_TIME_DELTA_MAXIMUM_STATIC = 30;
65  static const int ELEGANT_STARBEAM_SIZE = 15000;
66  static const int EMAIL_ATTACHMENT_MAXIMUM_SIZE = 10 * 1024 * 1024;
67  static const int EPKS_TIME_DELTA = 30;
68  static const int FORWARD_SECRECY_TIME_DELTA_MAXIMUM_STATIC = 30;
69  static const int GEMINI_TIME_DELTA_MAXIMUM_STATIC = 90;
70  static const int HARVEST_POST_OFFICE_LETTERS_INTERVAL = 5;
71  static const int IDENTICAL_CREDENTIALS_ITERATIONS = 5;
72  static const int KERNEL_CERTIFICATE_DAYS_VALID = 7;
73  static const int KERNEL_URL_DISPATCHER_INTERVAL_STATIC = 60;
74  static const int LANE_WIDTH_DEFAULT = 104857600;
75  static const int LANE_WIDTH_MAXIMUM = LANE_WIDTH_DEFAULT;
76  static const int LANE_WIDTH_MINIMUM =
77  4096 < LANE_WIDTH_DEFAULT ? 4096 : LANE_WIDTH_DEFAULT; /*
78  ** Must be smaller
79  ** than the
80  ** default.
81  */
82  static const int LOG_FILE_MAXIMUM_SIZE = 8 * 1024 * 1024;
83  static const int MAIL_TIME_DELTA_MAXIMUM_STATIC = 90;
84  static const int MAXIMUM_ATTEMPTS_PER_POPTASTIC_POST = 2;
85  static const int MAXIMUM_COPY_KEY_SIZES = 10 * 1024 * 1024;
86  static const int MAXIMUM_DESCRIPTION_LENGTH_SEARCH_RESULTS = 500;
87  static const int MAXIMUM_KERNEL_GUI_SERVER_SINGLE_SOCKET_BUFFER_SIZE =
88 #ifdef SPOTON_MCELIECE_ENABLED
89  std::numeric_limits<int>::max();
90 #else
91  CHAR_BIT * 1024 * 1024;
92 #endif
93  static const int MAXIMUM_UDP_DATAGRAM_SIZE = 508;
94  static const int MINIMUM_SECURE_MEMORY_POOL_SIZE = 262144;
95  static const int MINIMUM_STARBEAM_PULSE_SIZE = 1024;
96  static const int MOSAIC_SIZE = 64;
97  static const int NAME_MAXIMUM_LENGTH = 64;
98  static const int NEIGHBOR_LIFETIME_MS = 10 * 60 * 1000;
99  static const int NEIGHBOR_SILENCE_TIME = 180;
100  static const int POPTASTIC_FORWARD_SECRECY_TIME_DELTA_MAXIMUM_STATIC = 60;
101  static const int POPTASTIC_GEMINI_TIME_DELTA_MAXIMUM_STATIC = 90;
102  static const int POPTASTIC_MAXIMUM_EMAIL_SIZE = 50 * 1024 * 1024;
103  static const int POPTASTIC_STATUS_INTERVAL = 60;
104  static const int REAP_POST_OFFICE_LETTERS_INTERVAL = 60;
105  static const int RSS_IMPORTS_PER_THREAD = 5;
106  static const int SEND_QUEUED_EMAIL_INTERVAL = 5;
107  static const int SMP_TIME_DELTA_MAXIMUM = 90;
108  static const int SPOTON_HOME_MAXIMUM_PATH_LENGTH = 256;
109  static const int STARBEAM_TIME_DELTA = 30;
110  static const int STATUS_INTERVAL = 15;
111  static const int STATUS_TEXT_MAXIMUM_LENGTH = 64;
112  static const int URL_CONTENT_SHARE_MAXIMUM_SIZE = 5 * 1024 * 1024;
113  static const int URL_TIME_DELTA = 30;
114  static const int WAIT_FOR_BYTES_WRITTEN_MSECS_MAXIMUM = 2500;
115  static const int WAIT_FOR_BYTES_WRITTEN_MSECS_PREFERRED = 250; /*
116  ** Please
117  ** consider
118  ** changing
119  ** if the
120  ** maximums
121  ** (BLUETOOTH,
122  ** SCTP, TCP,
123  ** UDP) are
124  ** changed.
125  */
126  static const qint64 MAXIMUM_BLUETOOTH_PACKET_SIZE = 1000;
127  static const qint64 MAXIMUM_NEIGHBOR_BUFFER_SIZE =
128  static_cast<qint64> (LANE_WIDTH_MAXIMUM); /*
129  ** The buffer size must be greater
130  ** than the content length.
131  */
132  static const qint64 MAXIMUM_NEIGHBOR_CONTENT_LENGTH =
133  104856576 < MAXIMUM_NEIGHBOR_BUFFER_SIZE ?
134  104856576 : MAXIMUM_NEIGHBOR_BUFFER_SIZE;
135  static const qint64 MAXIMUM_SCTP_PACKET_SIZE = 4096;
136  static const qint64 MAXIMUM_STARBEAM_PULSE_SIZE = 2500000;
137  static const qint64 MAXIMUM_TCP_PACKET_SIZE = 4096;
138  static const qint64 MINIMUM_NEIGHBOR_CONTENT_LENGTH =
139  256 < MAXIMUM_NEIGHBOR_CONTENT_LENGTH ?
140  256 : MAXIMUM_NEIGHBOR_CONTENT_LENGTH;
141  static const unsigned long int GEMINI_ITERATION_COUNT = 25000;
142 
143  /*
144  ** Dynamic values. Not a pleasant solution.
145  */
146 
147  static int CACHE_TIME_DELTA_MAXIMUM;
148  static int CHAT_TIME_DELTA_MAXIMUM;
149  static int FORWARD_SECRECY_TIME_DELTA_MAXIMUM;
150  static int GEMINI_TIME_DELTA_MAXIMUM;
151  static int KERNEL_URL_DISPATCHER_INTERVAL;
152  static int MAIL_TIME_DELTA_MAXIMUM;
153  static int POPTASTIC_FORWARD_SECRECY_TIME_DELTA_MAXIMUM;
154  static int POPTASTIC_GEMINI_TIME_DELTA_MAXIMUM;
155 
156  private:
157  spoton_common(void);
158  ~spoton_common();
159 };
160 
161 #endif
Definition: spot-on-common.h:43